<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Amazon Wishlist Tracker</title>
    </h:head>
    <h:body>
        <h:form>
            <h:outputText value="Add a new wishlist:" />
            <h:panelGrid columns="3">
                <h:outputLabel for="url" value="URL:" />
                <h:inputText id="url" value="#{harvesterBean.newWishlist.url}" size="100" />
                <h:message for="url" />
                <h:panelGroup />
                <h:commandButton value="GO!" action="#{harvesterBean.addWishlist}" />
                <h:panelGroup />
            </h:panelGrid>
        </h:form>
        <br />
        <ui:repeat value="#{harvesterBean.account.wishlists}" var="wishlist">
            <h:outputText value="Wishlist: #{wishlist.url}" />
            <ui:repeat value="#{wishlist.items}" var="item">
                <h:dataTable value="#{item.prices}" var="price">
                    <f:facet name="header">
                        <h:outputText value="#{item.title}" />
                    </f:facet>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Price" />
                        </f:facet>
                        <h:outputText value="#{price.price}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Date Seen" />
                        </f:facet>
                        <h:outputText value="#{price.dateSeen}" />
                    </h:column>
                </h:dataTable>
                <br />
            </ui:repeat>
            <br />
        </ui:repeat>
    </h:body>
</html>